<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Models\Relations\UserInfoTrait;
use Illuminate\Support\Facades\DB;

class UserReport extends Model
{
    use UserInfoTrait;
    protected $table = 'report';

    protected $fillable = ['id','user_id','app','app_id', 'reson', 'url', 'status','report_uid'];

    /**
     * 问题信息
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function companyqestions()
    {
        return $this->belongsTo('App\Models\Questions', 'app_id');
    }

    /**
     * 就业指南
     * @return [type] [description]
     */
    public function employ()
    {
        return $this->belongsTo('App\Models\Employ', 'app_id', 'id');
    }

    /**
     * 充电加油
     * @return [type] [description]
     */
    public function teaches()
    {
        return $this->belongsTo('App\Models\Teaches', 'app_id', 'id');
    }

    /**
     * 招聘职位信息
     * @return [type] [description]
     */
    public function jobs()
    {
        return $this->belongsTo('App\Models\CompanyJobs', 'app_id', 'jobs_id');
    }

    public function resource($app,$appid)
    {
        return DB::table($app)->where('id','=',$appid)->first();
    }
}
